import { getMovieDetail} from "@/api/index"
const state = {
    detailst:{}
}

const actions = {
    async details ({commit},id) {
        // 调用接口，获取数据
        let result = await getMovieDetail(id)
        commit('DETAILS',result.movieDetail)
        
    }
}

const mutations = {
    DETAILS(state,movieDetail){
        state.detailst = movieDetail[0] || {}
    }
}

const getters = {
    movieDetailType(state){
        return state.detailst.type || []
    },
    movieDetailActors(state){
        return state.detailst.actors || []
    },
    movieDetailEvaluate(state){
        return state.detailst.evaluate || {}
    }
}

export default {
    actions,
    mutations,
    state,
    getters
}